from PyQt6.QtWidgets import QApplication, QMainWindow, QCheckBox, QButtonGroup


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        # 创建两个复选框
        self.checkBox1 = QCheckBox("选项 1", self)
        self.checkBox1.move(50, 50)

        self.checkBox2 = QCheckBox("选项 2", self)
        self.checkBox2.move(50, 100)

        # 创建按钮组并设置互斥
        self.buttonGroup = QButtonGroup(self)
        self.buttonGroup.addButton(self.checkBox1)
        self.buttonGroup.addButton(self.checkBox2)
        self.buttonGroup.setExclusive(True)  # 设置为互斥


if __name__ == "__main__":
    app = QApplication([])
    window = MainWindow()
    window.resize(200, 200)
    window.show()
    app.exec()
